home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 17 / CU Amiga Magazine's Super CD-ROM 17 (1997)(EMAP Images)(GB)[!][issue 1997-12].iso / CUCD / Programming / DiceSource / src / dc1 / tech.doc < prev    next >
Text File  |  1993-01-17  |  817b  |  45 lines

  1.  
  2.  
  3.     STACK CHECKING CODE
  4.  
  5.     movem.l regs,-(sp)
  6.     link    A5,#-10
  7.     cmp.l    __stack_end(A4),A5      STACKCHK    (A5 prevets link/unlk
  8.     blo    l1            STACKCHK    from being opt'd out)
  9.     bsr    __stack_alloc(pc)       STACKCHK
  10. l1
  11.  
  12.         .
  13.         .
  14.         .
  15.     unlk    A5        (move A5,sp,  move (sp)+,A5)
  16.     movem.l (sp)+,regs
  17.     rts
  18.  
  19.     With Stack Checking
  20.  
  21.     movem.l regs,-(sp)
  22.     link    A5,#-10
  23.     cmp.l    __stack_end(A4),sp
  24.     blo    l1
  25.     bsr    __stack_alloc(pc)
  26. l1
  27.  
  28.         .
  29.         .
  30.         .
  31.  
  32.     unlk    A5
  33.     movem.l (sp)+,regs/A5
  34.     rts
  35.  
  36.     Note that any passed variables are referenced A5-relative, any A7-rel
  37.     referenced variables have already been preloaded.  A5 is dropped
  38.     by __stack_alloc but not otherwise modified.  A new stack may be
  39.     allocated in which case A7 will have the new stack.  A5 is used as
  40.     a way pointer since it will be the same at __stack_free.
  41.  
  42.  
  43.  
  44.  
  45.